package cn.circle.system.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.validator.constraints.NotEmpty;

/**
 * 功能：客户实体类 
 * 对应数据库表：SYS_CUSTOMER 
 * 作者： 
 * 时间：
 */

@Entity
@Table(name = "SYS_CUSTOMER")
@DynamicInsert(true)
@DynamicUpdate(true)
public class SysCustomer {

	private Integer custId; // 客户id，唯一，自增长，主键
	private String userName; // 用户名称，不唯一
	private String passWord; //登入密码
	private SysRoles sysRoles;
	private SysDepartment sysDepartment;//department部门表的ID
	private String phone;//管理员联系手机号码
	private String photo;
	private java.sql.Timestamp createTime;//创建时间
	private Date lastLoginTime;
	private String loginIp;
	private Byte status;//状态：9为正常，0为移除（不是删除）
	
	
	@Id
	@Column(name = "CUST_ID", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.AUTO) // 自增长
	public Integer getCustId() {
		return custId;
	}
	public void setCustId(Integer custId) {
		this.custId = custId;
	}
	@NotEmpty
	@Column(name = "USER_NAME", nullable = false)
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	@NotEmpty
	@Column(name = "PASSWORD",nullable = false)
	public String getPassWord() {
		return passWord;
	}
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}
	@ManyToOne(targetEntity = SysRoles.class)
	@JoinColumn(name = "ROLE_ID")
	public SysRoles getSysRoles() {
		return sysRoles;
	}
	public void setSysRoles(SysRoles sysRoles) {
		this.sysRoles = sysRoles;
	}
	@ManyToOne(targetEntity = SysDepartment.class)
	@JoinColumn(name = "DEP_ID")
	public SysDepartment getSysDepartment() {
		return sysDepartment;
	}
	public void setSysDepartment(SysDepartment sysDepartment) {
		this.sysDepartment = sysDepartment;
	}
	@Column(name = "PHOTO")
	public String getPhoto() {
		return photo;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	@Column(name = "PHONE", nullable = false)
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	@Column(name = "CREATE_TIME", columnDefinition = "timestamp default CURRENT_TIMESTAMP")
	public java.sql.Timestamp getCreateTime() {
		return createTime;
	}
	public void setCreateTime(java.sql.Timestamp createTime) {
		this.createTime = createTime;
	}
	@Column(name = "LAST_LOGIN_TIME")
	public Date getLastLoginTime() {
		return lastLoginTime;
	}
	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}
	@Column(name = "LOGIN_IP")
	public String getLoginIp() {
		return loginIp;
	}
	public void setLoginIp(String loginIp) {
		this.loginIp = loginIp;
	}
	@Column(name = "STATUS", nullable = false, columnDefinition = "tinyint default 9")
	public Byte getStatus() {
		return status;
	}
	public void setStatus(Byte status) {
		this.status = status;
	}

}
